<?php

namespace app\admin\controller\rbac;

use app\admin\model\UM as UM;
use app\admin\service\PagesService;
use ShidianUtil\Thinkphp\Response\ApiResponse;
use think\APP;
use think\Request as Request;

/**
 * Pages 控制器
 * Class Pages
 * @package app\admin\controller\rbac;
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037509
 * @see \app\admin\validate\rbac\Pages
 */
class Pages
{
    // 请求参数
    private Request $request;

    // service
    private PagesService $service;

    public function __construct(Request $request, PagesService $pagesService)
    {
        $this->request = $request;
        $this->service = $pagesService;
    }

    /**
     * 页面列表
     * @param UM|null $user
     * @return ApiResponse
     * @url /rbac/pages/index
     */
    public function index(?UM $user): ApiResponse
    {
        $request = $this->request;

        return ApiResponse::success($this->service->index($user));
    }

}
